import axios from '../axios'

export default {
    /**
     * 
     * @data {{"courseId": 0,"duration": 0,"id": 0,"isFree": "string","sort": 0,"status": "string","title": "string","video": "string"}} data
     */
    // 新增课时
    addLesson(data) {
        console.log(data, '发往后端99999');
        return axios({
            url: "/admin/lesson/add",
            method: "post",
            data
        })
    },
    /**
     * 
     * @param {id} params 
     */
    // 删除课时
    deleteLesson(params) {
        return axios({
            method: "get",
            url: `/admin/lesson/delete/{id}?id=${params}`,
        })
    },
    /**
     * 
     * @param {courseId(课称ID),duration(课时时长),id(id,增加时不用传入，删除时必填),isFree(课时是否免费),sort(课时序号),status(课时状态。y：正常；n：下架),title(课时标题),video(课时视频地址)} params 
     */
    // 修改课时
    alterLesson(params) {
        return axios({
            url: "/admin/lesson/update",
            method: "post",
            params
        })
    },
    /**
     * 
     * @param {lessonVideo(file)(formData)} params 
     */
    // 上传课时视屏
    uploadLesson(lessonVideo) {
        return axios({
            url: "/admin/lesson/upload",
            method: "post",
            data: lessonVideo
        })
    },
    /**
     * 
     * @param {id} params 
     */
    // 查看课时 
    viewLesson(params) {
        return axios({
            method: "get",
            url: '/admin/lesson/view',
            params
        })
    },
    viewForCourse(params) {
        return axios({
            method: "get",
            url: `/admin/lesson/viewforcourse/${params}`,

        })
    },
}
